package com.chris.core.socket.bio.run;

import com.chris.core.socket.bio.util.BioSokcetClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;

public class BioClient {


    public static void main(String[] args) throws InterruptedException, IOException {
        // 断言默认 \r\n
        BioSokcetClientUtil service = new BioSokcetClientUtil("127.0.0.1", 10103,200000,false,"") {
            Logger log = LoggerFactory.getLogger(this.getClass());

            @Override
            public void OnRevice(String msg) {
                log.debug("客户端->读取->服务端:-->内容:" + msg);
            }

        };

        service.Open();

        Thread.sleep(6000);
        service.SendMsg("传输文件\r\nasdfasdfsdf");
       // File file = new File("./tip.log");
       // if (file != null && file.isFile() && file.exists()) {
       //     service.SendFile("c_"+file.getName(),file);
      //  }
        service.SendMsg("传输结束");
        service.Stop();
    }



    public static void maina (String[] args) throws InterruptedException, IOException {
        // 断言默认 \r\n
        BioSokcetClientUtil service = new BioSokcetClientUtil("119.91.204.20", 10180,200000,false,"") {
            Logger log = LoggerFactory.getLogger(this.getClass());

            @Override
            public void OnRevice(String msg) {
                log.debug("客户端->读取->服务端:-->内容:" + msg);
            }

        };

        service.Open();

        Thread.sleep(6000);
        service.SendMsg("3445040100113030303130313030303030303262AC4F0F");

        while (true)
        {

        }
    }
}
